<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
          integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
            integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
            crossorigin="anonymous"></script>
    <title>所有数据库表</title>
    <script type="text/javascript">
        // $(document).ready(function () {
            // $("#select_button").on('click', function () {
            //     var checkids = [];
            //     var data = [];
            //     $("input[name='ckb']:checked").each(function (i) {
            //         checkids[i] = $(this).val();
            //     });
            //     if (checkids.length <= 0) {
            //         $.notify('请选择请假单', {status: "danger"});
            //     } else {
            //         console.log(checkids);
            //         $("#dgFlowList").find(":checkbox:checked").each(function () {
            //             var val = $(this).parents("tr").text();
            //             data.push(val);
            //         });
            //         console.log(data);
            //     }
            // })
            // for (var i = 0; i <= tables.length; i++) {
            //     $("#table" + i).on("click", function () {
            //         debugger
            //         alert(i);
            //     });
            // }
        // })
        function deleteCurrentRow(obj) {
            var tr = obj.parentNode.parentNode;
            var tbody = tr.parentNode;
            tbody.removeChild(tr);
            //只剩行首时删除表格
            if (tbody.rows.length == 0) {
                tbody.parentNode.removeChild(tbody);
            }
        }
        function checkboxOnclick(checkbox,val)
        {
            if(checkbox == true){
                debugger
                alert(val);
            }
        }
    </script>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-4">
            <label class="col-form-label" for="prefix">表前缀</label>
            <input id="prefix" type="text" class="form-control">
        </div>
        <div class="col-4">
            <label class="col-form-label" for="author">作者</label>
            <input id="author" type="text" class="form-control">
        </div>
        <div class="col-4">
            <button class="btn btn-primary">生成代码</button>
        </div>
    </div>
    <div class="row">
        <div class="col-5">
            <label for="search" class="col-form-label"></label>
            <input id="search" placeholder="表名" type="text" class="col-3 form-control" style="display: inline-block">
            <button type="button" class="btn btn-primary">搜索</button>
        </div>




        <table class="table table-sm text-nowrap">
            <thead>
            <tr>
                <th></th>
                <th scope="col">表名</th>
                <th scope="col">表注释</th>
                <th scope="col">创建时间</th>
            </tr>
            </thead>
            <tbody style="height: 400px;overflow: scroll">
            <tr th:each="i : ${tables}" >
                <td>
                    <label>
                        <input type="checkbox" th:value="${i.tableName}" onclick="checkboxOnclick(this.checked,this.attributes[1].nodeValue)">
                    </label>
                </td>
                <td th:text="${i.tableName}"></td>
                <td th:text="${i.comment}"></td>
                <td th:text="${#dates.format(i.createTime,'yyyy-MM-dd hh:mm:ss')}"></td>
            </tr>
            </tbody>
        </table>
    </div>
</div>

</body>
</html>